
#include <stdio.h>


#define N 100


int main () {
    int i, j, size;
    double * a;
    double * b;

    a = malloc(N * sizeof(double));
    b = malloc(N * sizeof(double));
    size = N;
    for (i = 0; i < size; i++) {
        a[i] = 0.0f;
        b[i] = 33.0f;
    }


    #pragma acc data copy(a[100],size)
    for (i = 0; i < size; i++) {
        #pragma acc kernels loop pcopy(b[100]) private(j) copyin(i)
        for (j = 0; j < size; j++) {  
            a[j] = j;
            b[i] = 5.0;
        }  
        // This update should not be neccessary !
        // #pragma acc update device(b)
        printf("b[2] = %g \n", b[2]);
    }


    free(a);
    free(b);
}
